package com.reny.git.imgload.glide

import android.content.Context
import android.graphics.Bitmap
import android.graphics.drawable.Drawable
import android.view.View
import android.widget.ImageView
import androidx.annotation.DrawableRes
import androidx.annotation.NonNull
import com.bumptech.glide.request.target.ImageViewTarget
import java.io.File

interface ILoader {

    fun display(@NonNull view: View, model:Any?, owner: Any,
                    header : HashMap<String, String>,
                    radius : Int, isBlur: Boolean,
                    @DrawableRes placeHolder: Int,
                    @DrawableRes errorHolder: Int,
                    @DrawableRes fallbackHolder: Int
    )


    fun displayTarget(@NonNull view: ImageView, model:Any?, target: ImageViewTarget<Bitmap>, owner: Any)


    //缓存到磁盘中 非内存中
    fun cache(
        context: Context,
        model: Any?,
        width: Int?,
        height: Int?
    )

    //先调用cache后才能调用  加载缓存的图片
    fun displayCache(view: View, model: Any?)

    fun loadBitmap(
        context: Context,
        model: Any?,
        callBack: (Bitmap?)->Unit
    )

    fun loadDrawable(
        context: Context,
        model: Any?,
        callBack: (Drawable?)->Unit
    )

    //下载完成 需要自己存储返回的File
    fun downLoadImg(
        context: Context,
        model: Any?,
        callBack: (File?)->Unit
    )

    fun pauseRequests(context: Context)

    fun resumeRequests(context: Context)

}